	function sendMobileCode(){
		if(checkTel()){
			var mobile = $("#phone").val();
			$.ajax({
				type:"get",
				url:"/api/login/sendRegSMS",
				async:true,
				dataType:"json",
				data:{"tel":mobile},
				success:function(data){
					//var data = JSON.parse(data);
                    console.log(data);
				}
			})
		}
	}
	
	function register(){
		var username = $("#name").val();
		var userAccount = $("#phone").val();
		var yzcode=$("#code").val();
		var userPwd=md5($('#password').val());
		
		if($("#password").val()!=$("#passwordRepeat").val()){
			alert("密码不一致");
			return false;
		}
		
		$.ajax({
			type:"get",
			url:"/api/login/register",
			async:true,
			data:{"name":username,"phone":userAccount,"code":yzcode,"password":userPwd},
			dataType:'json',
			success: function (data) {
				if(data.success){
					window.location.href = "login.html";
				}else{
					alert(data.message);
				}
            }
		});
	}
	
	//检验手机验证码格式是否正确
	function checkTel() {
	    var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
	    var isMob = /^((\+?86)|(\(\+86\)))?(13[0123456789][0-9]{8}|17[0123456789][0-9]{8}|15[0123456789][0-9]{8}|18[0123456789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;
	    var value = document.getElementById("phone").value.trim();
	    if (isMob.test(value) || isPhone.test(value)) {
	        return true;
	    } else {
	       alert("请输入正确的手机号码");
	        return false;
	    }
	}
